package com.mystudy.thread;

/**
 * @program: infoalgorithm
 * @description:
 * @author: zhouzhilong
 * @create: 2019-06-24 10:25
 **/
public class MyThread extends Thread {

    @Override
    public void run() {
        DataDemo instance = DataDemo.getInstance();
        System.out.println("thread:" + this.currentThread().getName());
        if (this.currentThread().getName().equals("set")) {
            try {
                instance.set();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(instance);
        } else {
            try {
                instance.get();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
